package org.gpp.proj1.logic.shop.list;

import java.io.FileNotFoundException;
import java.util.Map;

import junit.framework.TestCase;

import org.gpp.proj1.logic.metadata.PartCategory;
import org.gpp.proj1.logic.metadata.PartEntry;

/**
 * @author Paolo Victor, paolovictor@gmail.com
 */
public class PartListLoaderTest extends TestCase {
	public void testLoadParts() {
		try {
			PartListLoader.loadParts( "IDONOTEXIST" );
			fail();
		} catch (FileNotFoundException e) {
			// expected
		}
		
		try {
			Map<PartCategory, Map<String, PartEntry>> parts = PartListLoader.loadParts( "test/part/parts.list" );
			
			assertEquals( 4, parts.keySet().size() );
			
			assertTrue( parts.containsKey( PartCategory.HEAD ) );
			assertTrue( parts.containsKey( PartCategory.ARM ) );
			assertTrue( parts.containsKey( PartCategory.LEGS ) );
			assertTrue( parts.containsKey( PartCategory.TORSO ) );
						
		} catch (FileNotFoundException e) {
			fail();
		}
	}
}
